//
//  BVBottomView.m
//  XiangYu
//
//  Created by YYKJ on 2017/8/8.
//  Copyright © 2017年 YYKJ. All rights reserved.
//

#import "BVBottomView.h"

@implementation BVBottomView

-(instancetype)init{
    
    if (self = [super init]) {
        [self makeSubViews];
    }
    return self;
}

-(void)makeSubViews{
    
    [self setBackgroundColor:[UIColor whiteColor]];
    
    UIView *line = [[UIView alloc]init];
    [self addSubview:line];
    [line setBackgroundColor:[UIColor BVLineGrayColor]];
    [line setFrame:CGRectMake(0, 0, ScreenW, 1.0)];
    
    UIButton *btn1 = [self buttonTitle:@"分享" tag:100 img:@"zhuan"];
    [btn1 setImageEdgeInsets:UIEdgeInsetsMake(10, 5, 10, 10)];
    btn1.sd_layout
    .leftSpaceToView(self, 20)
    .topSpaceToView(self, 1)
    .widthIs(80)
    .heightIs(39);
    
    UIButton *btn2 = [self buttonTitle:@"评论" tag:200 img:@"ping"];
    btn2.sd_layout
    .centerXIs(ScreenW/2)
    .topSpaceToView(self, 1)
    .widthIs(80)
    .heightIs(39);
    
    UIButton *btn3 = [self buttonTitle:@"赞" tag:300 img:@"zansan"];
    btn3.sd_layout
    .topSpaceToView(self, 1)
    .rightSpaceToView(self, 20)
    .widthIs(80)
    .heightIs(39);

}

-(UIButton *)buttonTitle:(NSString *)title tag:(NSInteger )tag img:(NSString *)img{
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self addSubview:btn];
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor BVTextDarkGrayColor] forState:UIControlStateNormal];
    [btn.titleLabel setFont:[UIFont systemFontOfSize:16]];
    [btn setImage:[UIImage imageNamed:img] forState:UIControlStateNormal];
    return btn;
}

@end
